package reaction.europarl;

import java.io.File;
import java.io.IOException;

import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;

import reaction.news.index.MyPortugueseAnalyzer;

public class Definitions {
	
	
	/* to control which features are going to be generated */
	public static boolean linkDisambiguation = true;
	public static boolean textualSimilarities = true;
	public static boolean nameSimilarities = true;
	public static boolean topicalSimilarities = true;
	
	/* Lucene stuff */
	public static MyPortugueseAnalyzer analyzer = new MyPortugueseAnalyzer(Version.LUCENE_35);
		
	// WikipediaPT index
	public static String wikipediaIndexLocation = "/srv/dsbatista/WikipediaIndex";	
	public static Directory wikipediaIndexDirectory;
	public static IndexSearcher wikipediaSearcher;	
	
	// EuroParl index
	public static String europarlIndexLocation = "/srv/dsbatista/Europarl-PT-Index";	
	public static Directory europarlIndexDirectory;
	public static IndexSearcher europarlSearcher;
	
	/* 3rd party software */
	public static String SVMRankPath = "SVMRank/";
	public static String SVMRanklLearn = "svm_rank_learn";
	public static String SVMRanklClassify = "svm_rank_classify";

	public static String SVMLightPath = "SVMLight/";
	public static String SVMLightLearn = "svm_learn";
	public static String SVMLightClassify = "svm_classify";
	
	public static void init() {
		
		/* WikipediaPT Lucene Index */
		try {
			
			wikipediaIndexDirectory = FSDirectory.open(new File(wikipediaIndexLocation));
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			
			wikipediaSearcher = new  IndexSearcher((IndexReader.open(wikipediaIndexDirectory)));
			
		} catch (CorruptIndexException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
				
		/* EuroParl Lucene Index */
		try {
			
			europarlIndexDirectory = FSDirectory.open(new File(europarlIndexLocation));
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			
			europarlSearcher = new  IndexSearcher((IndexReader.open(europarlIndexDirectory)));
			
		} catch (CorruptIndexException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

